
<style>
    .centerDiv {
        width: 200px;
        height: 200px;
        border: 1px solid #ccc;
        position: absolute;
        left: 50%;
        top: 50%;
        margin-left: -50px;
        margin-top: -50px;
        /*background: #eee;*/
    }

    .desert1 {
        background-image: url('./imgs/tile-desert-1.png');
    }

    .desert2 {
        background-image: url('./imgs/tile-desert-2.png');
    }

</style>

<!-- 1) 为 class 添加属性 -->
<div class="centerDiv " onclick="switch_bg(this)"></div>
<script>
    function switch_bg(e) {
        // 2） 补充代码
    }
</script>
